<template>
    <header class="page__hd">
        <div class="hd__left">
            <div class="hd__title">
                <span class="hd__icon">
                    <slot name="hd-icon"></slot>
                </span>
                <slot name="hd-title"></slot>
            </div>
            <div class="hd__desc">
                <slot name="hd-desc"></slot>
            </div>
        </div>
        <div class="hd__right">
            <div class="home-btn" @click="goHome">
                <el-icon class="btn-icon"><HomeFilled /></el-icon>
                <span class="btn-text">返回首页</span>
            </div>
        </div>
  </header>
</template>

<script setup>
import { useRouter } from 'vue-router';

const router = useRouter();

const goHome = () => {
    router.push('/');
}
</script>

<style lang="scss" scoped>
$hd-bg: #BFCBC4;
$hd-home-btn-bg: #777F70;

.page__hd {
    height: 15vh;
    padding: 0 2rem;
    background: $hd-bg;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .hd__left {
        .hd__title {
            display: flex;
            align-items: center;
            font-size: 2rem;
            font-weight: bold;
            color: #333;
            .hd__icon {
            margin-right: 1rem;
            }
        }
        .hd__desc {
            margin-top: 1rem;
            font-size: 1.5rem;
            color: #666;
        }
    }
    .hd__right {
        .home-btn {
            height: 12vh;
            width: 8vw;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: #fff;
            background-color: $hd-home-btn-bg;
            border-radius: 20px;
            cursor: pointer;
            .btn-icon {
                font-size: 2rem;
                margin-bottom: 0.5rem;
            }
            .btn-text {
                font-size: 1rem;
            }
        }
        .home-btn:hover {
            background-color: darken($hd-home-btn-bg, 10%);
        }
    }
}
</style>